<%layout("../common/_layout.html", {nav: "文章分类管理"}) {%>
<div class="result-title">
<div class="result-list">
  <form id="addForm" action="/admin/catalog/save" method="post" onsubmit="return check();">
    分类名称: <input type="text" id="catalogName" name="catalog.name">&nbsp;
    <input type="submit" class="btn btn-primary btn6 mr10" value="添加分类">
  </form>
</div>
</div>
<div class="result-content">
<table class="result-tab">
  <tr>
    <th width="5%">No.</th>
    <th>分类名称</th>
    <th>操作</th>
  </tr>
  <%for(catalog in catalogList) {%>
  <tr>
    <td>${catalogLP.index}</td>
    <td>${catalog.name}</td>
    <td>
      <a class="link-update" href="/admin/catalog/edit?id=${catalog.id }">修改</a>&nbsp;
      <a class="link-del" href="/admin/catalog/delete?id=${catalog.id }" onclick="return confirm('删除后无法恢复,确定要删除吗')">删除</a>&nbsp;
    </td>
  </tr>
  <%}%>
</table>
</div>
<script type="javascript">
  function check() {
    if($("#catalogName").val() == "") {
      alert("分类名称不允许为空");
      return false;
    } else {
      return true;
    }
  }
</script>
<%}%>